<?php

namespace Esseak\FetchPackage\Console;

use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Carbon;

class InstallCommand extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'fetch:install';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '安装fetch包 【step 2】';

    /**
     * Execute the console command.
     *
     * @return int
     */
    public function handle()
    {
        $this->call('admin:install');
        $this->call('migrate');

        //添加菜单
        DB::table('admin_menu')->insert([
            'parent_id'=>'0',
            'order'=>'20',
            'title'=>'videos',
            'icon'=>'fa-product-hunt',
            'uri'=>'videos',
            'extension'=>'',
            'show'=>1,
            'created_at'=>Carbon::now()
        ]);
        return 0;
    }
}
